﻿using Koala.Pro.CodeGenerator.UI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Koala.Pro.CodeGenerator.UI.Models
{
    [Serializable]
    public class ProjectData
    {
        private const string SETTING_FILE = "SimpleEntityProject/ProjectData.xml";

        private ProjectName projectNameList;

        public ProjectName ProjectNameList
        {
            get
            {
                return projectNameList;
            }
            set
            {
                projectNameList = value;
            }
        }

        public void Load()
        {
            ProjectData projectData = new ProjectData();
            try
            {
                projectData = XmlUtils.LoadObjectFromXml("SimpleEntityProject/ProjectData.xml", typeof(ProjectData)) as ProjectData;
                ProjectNameList = projectData.ProjectNameList;
            }
            catch
            {
            }
        }

        public bool Save()
        {
            bool result = false;
            try
            {
                XmlUtils.SaveObjectToXml("SimpleEntityProject/ProjectData.xml", this);
                result = true;
            }
            catch
            {
            }
            return result;
        }
    }
}
